﻿<!DOCTYPE HTML>
<html lang="zh">

<head>
<title>Script 脚本展示 | AutoHotkey v2</title>
<meta name="description" content="This showcase lists some scripts created by different authors which show what AutoHotkey might be capable of." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>

<body>

<h1>AutoHotkey 脚本展示</h1>
<p>This showcase lists some scripts created by different authors which show what AutoHotkey might be capable of. For more ready-to-run scripts and functions, see <a href="https://www.autohotkey.com/boards/viewforum.php?f=83">AutoHotkey v2 Scripts and Functions Forum</a>.</p>

<h2>Table of Contents</h2>
<ul>
  <li><a href="#ContextSensitiveHelp">Context Sensitive Help in Any Editor</a></li>
  <li><a href="#EasyWindowDrag">Easy Window Dragging</a></li>
  <li><a href="#EasyWindowDrag_(KDE)">Easy Window Dragging (KDE style)</a></li>
  <li><a href="#FavoriteFolders">Easy Access to Favorite Folders</a></li>
  <li><a href="#IntelliSense">IntelliSense</a></li>
  <li><a href="#JoystickMouse">Using a Joystick as a Mouse</a></li>
  <li><a href="#JoystickTest">Joystick Test Script</a></li>
  <li><a href="#KeyboardOnScreen">On-Screen Keyboard</a></li>
  <li><a href="#MinimizeToTrayMenu">Minimize Window to Tray Menu</a></li>
  <li><a href="#MsgBoxButtonNames">Changing MsgBox's Button Names</a></li>
  <li><a href="#Numpad000">Numpad 000 Key</a></li>
  <li><a href="#NumpadMouse">Using Keyboard Numpad as a Mouse</a></li>
  <li><a href="#Seek_(SearchTheStartMenu)">Seek (Search the Start Menu)</a></li>
  <li><a href="#TooltipMouseMenu">ToolTip Mouse Menu</a></li>
  <li><a href="#VolumeOSD">Volume On-Screen-Display (OSD)</a></li>
  <li><a href="#WindowShading">Window Shading</a></li>
  <li><a href="#WinLIRC">WinLIRC Client</a></li>
  <li><a href="#Scripts_and_Functions_Forum">AutoHotkey v1 Scripts and Functions Forum</a></li>
</ul>

<h2 id="ContextSensitiveHelp">Context Sensitive Help in Any Editor</h2>
<p>Based on the v1 script by Rajat</p>
<p>This script makes <kbd>Ctrl</kbd>+<kbd>2</kbd> (or another hotkey of your choice) show the help file page for the selected AutoHotkey function or keyword. If nothing is selected, the function name will be extracted from the beginning of the current line.</p>
<p class="show_code"><a href="ContextSensitiveHelp.ahk">Show code</a></p>

<h2 id="EasyWindowDrag">Easy Window Dragging</h2>
<p>Normally, a window can only be dragged by clicking on its title bar. This script extends that so that any point inside a window can be dragged. To activate this mode, hold down <kbd>CapsLock</kbd> or the middle mouse button while clicking, then drag the window to a new position.</p>
<p class="show_code"><a href="EasyWindowDrag.ahk">Show code</a></p>

<h2 id="EasyWindowDrag_(KDE)">Easy Window Dragging (KDE style)</h2>
<p>Based on the v1 script by Jonny</p>
<p>This script makes it much easier to move or resize a window: 1) Hold down the <kbd>Alt</kbd> key and LEFT-click anywhere inside a window to drag it to a new location; 2) Hold down <kbd>Alt</kbd> and RIGHT-click-drag anywhere inside a window to easily resize it; 3) Press <kbd>Alt</kbd> twice, but before releasing it the second time, left-click to minimize the window under the mouse cursor, right-click to maximize it, or middle-click to close it.</p>
<p class="show_code"><a href="EasyWindowDrag_(KDE).ahk">Show code</a></p>

<h2 id="FavoriteFolders">Easy Access to Favorite Folders</h2>
<p>Based on the v1 script by Savage</p>
<p>When you click the middle mouse button while certain types of windows are active, this script displays a menu of your favorite folders. Upon selecting a favorite, the script will instantly switch to that folder within the active window. The following window types are supported: 1) Standard file-open or file-save dialogs; 2) Explorer windows; 3) Console (command prompt) windows. The menu can also be optionally shown for unsupported window types, in which case the chosen favorite will be opened as a new Explorer window.</p>
<p class="show_code"><a href="FavoriteFolders.ahk">Show code</a></p>

<h2 id="IntelliSense">IntelliSense</h2>
<p>Based on the v1 script by Rajat</p>
<p>This script watches while you edit an AutoHotkey script. When it sees you type a command followed by a comma or space, it displays that command's parameter list to guide you. In addition, you can press <kbd>Ctrl</kbd>+<kbd>F1</kbd> (or another hotkey of your choice) to display that command's page in the help file. To dismiss the parameter list, press <kbd>Escape</kbd> or <kbd>Enter</kbd>.</p>
<p class="show_code"><a href="IntelliSense.ahk">Show code</a></p>

<h2 id="JoystickMouse">Using a Joystick as a Mouse</h2>
<p>This script converts a joystick into a three-button mouse. It allows each button to drag just like a mouse button and it uses virtually no CPU time. Also, it will move the cursor faster depending on how far you push the joystick from center. You can personalize various settings at the top of the script.</p>
<p class="show_code"><a href="JoystickMouse.ahk">Show code</a></p>

<h2 id="JoystickTest">Joystick Test Script</h2>
<p>This script helps determine the button numbers and other attributes of your joystick. It might also reveal if your joystick is in need of calibration; that is, whether the range of motion of each of its axes is from 0 to 100 percent as it should be. If calibration is needed, use the operating system's control panel or the software that came with your joystick.</p>
<p class="show_code"><a href="JoystickTest.ahk">Show code</a></p>

<h2 id="KeyboardOnScreen">On-Screen Keyboard</h2>
<p>Based on the v1 script by Jon</p>
<p>This script creates a mock keyboard at the bottom of your screen that shows the keys you are pressing in real time. I made it to help me to learn to touch-type (to get used to not looking at the keyboard). The size of the on-screen keyboard can be customized at the top of the script. Also, you can double-click the tray icon to show or hide the keyboard.</p>
<p class="show_code"><a href="KeyboardOnScreen.ahk">Show code</a></p>

<h2 id="MinimizeToTrayMenu">Minimize Window to Tray Menu</h2>
<p>This script assigns a hotkey of your choice to hide any window so that it becomes an entry at the bottom of the script's tray menu. Hidden windows can then be unhidden individually or all at once by selecting the corresponding item on the menu. If the script exits for any reason, all the windows that it hid will be unhidden automatically.</p>
<p class="show_code"><a href="MinimizeToTrayMenu.ahk">Show code</a></p>

<h2 id="MsgBoxButtonNames">Changing MsgBox's Button Names</h2>
<p>This is a working example script that uses a timer to change the names of the buttons in a MsgBox dialog. Although the button names are changed, the MsgBox's return value still requires that the buttons be referred to by their original names.</p>
<p class="show_code"><a href="MsgBoxButtonNames.ahk">Show code</a></p>

<h2 id="Numpad000">Numpad 000 Key</h2>
<p>This example script makes the special <kbd>000</kbd> key that appears on certain keypads into an equals key. You can change the action by replacing the <code>Send "="</code> line with line(s) of your choice.</p>
<p class="show_code"><a href="Numpad000.ahk">Show code</a></p>

<h2 id="NumpadMouse">Using Keyboard Numpad as a Mouse</h2>
<p>Based on the v1 script by deguix</p>
<p>This script makes mousing with your keyboard almost as easy as using a real mouse (maybe even easier for some tasks). It supports up to five mouse buttons and the turning of the mouse wheel. It also features customizable movement speed, acceleration, and &quot;axis inversion&quot;.</p>
<p class="show_code"><a href="NumpadMouse.ahk">Show code</a></p>

<h2 id="Seek_(SearchTheStartMenu)">Seek (Search the Start Menu)</h2>
<p>Based on the v1 script by Phi</p>
<p>Navigating the Start Menu can be a hassle, especially if you have installed many programs over time. 'Seek' lets you specify a case-insensitive key word/phrase that it will use to filter only the matching programs and directories from the Start Menu, so that you can easily open your target program from a handful of matched entries. This eliminates the drudgery of searching and traversing the Start Menu.</p>
<p class="show_code"><a href="Seek_(SearchTheStartMenu).ahk">Show code</a></p>

<h2 id="TooltipMouseMenu">ToolTip Mouse Menu</h2>
<p>Based on the v1 script by Rajat</p>
<p>This script displays a popup menu in response to briefly holding down the middle mouse button. Select a menu item by left-clicking it. Cancel the menu by left-clicking outside of it. A recent improvement is that the contents of the menu can change depending on which type of window is active (Notepad and Word are used as examples here).</p>
<p class="show_code"><a href="TooltipMouseMenu.ahk">Show code</a></p>

<h2 id="VolumeOSD">Volume On-Screen-Display (OSD)</h2>
<p>Based on the v1 script by Rajat</p>
<p>This script assigns hotkeys of your choice to raise and lower the master volume.</p>
<p class="show_code"><a href="VolumeOSD.ahk">Show code</a></p>

<h2 id="WindowShading">Window Shading</h2>
<p>Based on the v1 script by Rajat</p>
<p>This script reduces a window to its title bar and then back to its original size by pressing a single hotkey. Any number of windows can be reduced in this fashion (the script remembers each). If the script exits for any reason, all &quot;rolled up&quot; windows will be automatically restored to their original heights.</p>
<p class="show_code"><a href="WindowShading.ahk">Show code</a></p>

<h2 id="WinLIRC">WinLIRC Client</h2>
<p>This script receives notifications from <a href="http://winlirc.sourceforge.net">WinLIRC</a> whenever you press a button on your remote control. It can be used to automate Winamp, Windows Media Player, etc. It's easy to configure. For example, if WinLIRC recognizes a button named &quot;VolUp&quot; on your remote control, create a label named VolUp and beneath it use the function <code>SoundSetVolume "+5"</code> to increase the soundcard's volume by 5%.</p>
<p class="show_code"><a href="WinLIRC.ahk">Show code</a></p>

<h2 id="Scripts_and_Functions_Forum">AutoHotkey v1 Scripts and Functions Forum</h2>
<p>This forum contains many more scripts, but most scripts will not run as-is on AutoHotkey v2.0.</p>
<p><a href="https://www.autohotkey.com/boards/viewforum.php?f=6">AutoHotkey v1 Scripts and Functions Forum</a></p>

<p class="hide_code" style="display: none;">Hide code</p> <!-- required for translation -->

<script>
if (!isIE8)
  addOnClickEvent();

function addOnClickEvent() {
  var els = document.querySelectorAll('.show_code a');
  var text_show_code = els[0].innerHTML;
  var text_hide_code = document.querySelectorAll('.hide_code')[0].innerHTML;
  $.get(els[0].href, function() { // Check whether it is possible to get a file
    for (var i = 0; i < els.length; i++) {
      var el = els[i];
      var text = el.innerHTML;
      el.onclick = function() {
        if (this.innerHTML !== text_hide_code) {
          this.innerHTML = text_hide_code;
          if (!this.nextSibling) {
            pre = document.createElement('pre');
            pre.className = 'NoIndent';
            pre.setAttribute('filename', this.getAttribute('href'));
            this.parentNode.insertBefore(pre, this.nextSibling);
            $.get(this.href, function(data) {
              $(pre).text(data);
              features.addCodeBoxButtons([pre]);
              features.addSyntaxColors([pre]);
            }, 'text');
          }
          else
            this.nextSibling.style.display = 'block';
        }
        else {
          this.innerHTML = text_show_code;
          this.nextSibling.style.display = 'none';
        }
        return false; // Suppress opening the file in a normal way
      };
    }
  }, 'text');
}
</script>
</body>

</html>